// stores/userStore.ts
import { defineStore } from 'pinia';

export const useUserStore = defineStore('user', {
  state: () => ({
    isLoggedIn: false,  // 登录状态
    currentUser: null as string | null,
    currentUserName: null as string | null,
    star_projects: [] as any[],
    isvisitor:false
  }),
  actions: {
    login(userID:string, username:string) {
      this.isLoggedIn = true;
      this.currentUser = userID;
      this.currentUserName = username;
      this.star_projects = [];
    },
    logout() {
      this.isLoggedIn = false;
      this.currentUser = null;
      this.currentUserName = null;
      this.star_projects = [];
    },
  },
});
